<?php 
if (! isset($_SESSION)) session_start();
if (! isset($_SESSION["username"])) {
	echo "You are not auhtorized to change this content";
	exit;
}


$i = $_REQUEST["id"];

$header_file = "{$_SERVER["DOCUMENT_ROOT"]}/modules/course_boxes/templates/{$i}_header.dat";
$brief_file = "{$_SERVER["DOCUMENT_ROOT"]}/modules/course_boxes/templates/{$i}_brief.dat";
$content_file = "{$_SERVER["DOCUMENT_ROOT"]}/modules/course_boxes/templates/{$i}_content.dat";
$url_file = "{$_SERVER["DOCUMENT_ROOT"]}/modules/course_boxes/templates/{$i}_url.dat";
$color_file = "{$_SERVER["DOCUMENT_ROOT"]}/modules/course_boxes/templates/{$i}_color.dat";
$font_color_file = "{$_SERVER["DOCUMENT_ROOT"]}/modules/course_boxes/templates/{$i}_font_color.dat";

file_put_contents($header_file, $_REQUEST["header"]);
file_put_contents($brief_file, $_REQUEST["brief"]);
file_put_contents($content_file, $_REQUEST["content"]);
file_put_contents($url_file, $_REQUEST["url"]);
file_put_contents($color_file, $_REQUEST["color"]);
file_put_contents($font_color_file, $_REQUEST["font_color"]);


echo <<<STOP
Saved 
{$i}
"{$_REQUEST["header"]}" "{$_REQUEST["brief"]}" "{$_REQUEST["content"]}" "{$_REQUEST["url"]}"
{$_REQUEST["color"]} {$_REQUEST["font_color"]}
<br>
STOP;
?>